/**
 * 
 */
package com.ctn.information.data.retriever.impl;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONObject;

import com.ctn.information.data.model.Picture;
import com.ctn.information.data.retriever.Retriever;
import com.ctn.information.data.retriever.Interface.ADRetriever;
import com.ctn.information.exception.MethodNotSupportException;
import com.ctn.information.util.JsonUtil;

/**
 * @author Zale
 *
 */
public class ADRetrieverImpl implements ADRetriever {

	

	/* (non-Javadoc)
	 * @see com.ctn.information.data.retriever.Retriever#getAll(boolean)
	 */
	@Override
	public List<Picture> getAll(boolean asc) throws MethodNotSupportException{
		throw new MethodNotSupportException("Not support this method for AD");
	}

	/* (non-Javadoc)
	 * @see com.ctn.information.data.retriever.Interface.ADRetriever#getMainPageAD()
	 */
	@Override
	public Picture getMainPageAD() throws Exception {
			JSONObject jsonObj = JsonUtil.getJSON(Retriever.URL_MAIN_PAGE_AD);
			Picture pic = new Picture();
			JsonUtil.convertJsonToObj(pic, jsonObj);
		return pic;
	}

	/* (non-Javadoc)
	 * @see com.ctn.information.data.retriever.Interface.ADRetriever#getInfoAD()
	 */
	@Override
	public List<Picture> getInfoAD() throws Exception{
		JSONObject jsonObj = JsonUtil.getJSON(Retriever.URL_INFO_PAGE_AD);
		List<Picture> list = new ArrayList<Picture>();
		JsonUtil.convertJsonToObj(list, jsonObj);
		return null;
	}

	@Override
	public Picture getById(Long id) throws MethodNotSupportException {
		throw new MethodNotSupportException("Not support this method for AD");
	}

}
